import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sph_driver/AppConfig/Config.dart';

import '../../l10n/messages.dart';

class SelectComplaintForm extends StatefulWidget {
  //1.催促投诉 2.取消投诉 3.补充凭证
  final int chooseType;
  const SelectComplaintForm({super.key, required this.chooseType});

  @override
  State<SelectComplaintForm> createState() => _SelectComplaintFormState();
}

class _SelectComplaintFormState extends State<SelectComplaintForm> {

  int orderType=1;
  List orderIDList=["1111111","22222222222","33333333333"];
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    var messages = AppLocalizations.of(context)!;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor:Colors.white,
        centerTitle: true,
        title: Text("选择投诉单",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body: Column(
        children: [
          SizedBox(height: 1.h,),
          Container(
            color: Colors.white,
            child:Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                SizedBox(),
                GestureDetector(
                  child: Column(
                    children: [
                      Text("投诉",style: TextStyle (fontWeight:orderType==1? FontWeight.w600:FontWeight.w300,color:orderType==1?MyColors.themeColor: Colors.black,fontSize: orderType==1?14.sp:14.sp),),
                      SizedBox(height: 8.h,),
                      Container(height: 2.h,width: 27.w,color:orderType==1?Color.fromRGBO(231, 112, 27, 0.85) : Colors.white.withOpacity(0.0),),
                    ],
                  ),
                  onTap: (){
                    setState(() {
                      orderType=1;
                    });
                  },
                ),
                SizedBox(),
                GestureDetector(
                  child: Column(
                    children: [
                      Text("被投诉",style: TextStyle (fontWeight:orderType==2? FontWeight.w600:FontWeight.w300,color:orderType==2?MyColors.themeColor: Colors.black,fontSize: orderType==2?14.sp:14.sp),),
                      SizedBox(height: 8.h,),
                      Container(height: 2.h,width: 27.w,color:orderType==2?Color.fromRGBO(231, 112, 27, 0.85) : Colors.white.withOpacity(0.0),),
                    ],
                  ),
                  onTap: (){
                    setState(() {
                      orderType=2;
                    });
                  },
                ),
                SizedBox(),
              ],
            ),
          ),
          SizedBox(height: 8.h,),
          Container(
            height: screenSize.height-180.h,
            margin: EdgeInsets.only(left: 10.w,right: 10.w,bottom: 8.h),
            child: ListView.separated(
              // physics: NeverScrollableScrollPhysics(),
              shrinkWrap:false,
              itemCount: orderIDList.length,
              separatorBuilder: (BuildContext context, int index) {
                // 定义item之间的分隔符
                return Divider(
                  height: 8.0, // 设置分隔符高度
                  color: MyColors.backgreyColor,
                );
              },
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  height: 210.h,
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                  ),
                  padding: EdgeInsets.all(10.w),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("111****5555",style: TextStyle(color: Colors.black),),
                      SizedBox(height: 8.h,),
                      Container(height: 1.h,color: MyColors.backgreyColor,),
                      SizedBox(height: 15.h,),
                      Row(
                        children: [
                          Text("物流路线",style: TextStyle(color: MyColors.textColor),),
                          SizedBox(width: 8.w,),
                          Text("苏州市吴中区-苏州市吴中区",style: TextStyle(color: Colors.black),),
                        ],
                      ),
                      SizedBox(height: 6.h,),
                      Row(
                        children: [
                          Text("对方姓名",style: TextStyle(color: MyColors.textColor),),
                          SizedBox(width: 8.w,),
                          Text("张**",style: TextStyle(color: Colors.black),),
                        ],
                      ),
                      SizedBox(height: 6.h,),
                      Row(
                        children: [
                          Text("运单编号",style: TextStyle(color: MyColors.textColor),),
                          SizedBox(width: 8.w,),
                          Text(orderIDList[index],style: TextStyle(color: Colors.black),),
                        ],
                      ),
                      SizedBox(height: 6.h,),
                      Row(
                        children: [
                          Text("运单状态",style: TextStyle(color: MyColors.textColor),),
                          SizedBox(width: 8.w,),
                          Text("已完成",style: TextStyle(color: Colors.black),),
                        ],
                      ),
                      SizedBox(height: 6.h,),
                      Row(
                        children: [
                          Text("运单时间",style: TextStyle(color: MyColors.textColor),),
                          SizedBox(width: 8.w,),
                          Text("2023-05-23 11:55:25",style: TextStyle(color: Colors.black),),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: [
                          BrnSmallMainButton(
                            title: widget.chooseType==1?'催促投诉':widget.chooseType==2? '取消投诉':'补充凭证',
                            bgColor: MyColors.themeColor,
                            textColor: Colors.white,
                            radius: 30,
                            width: 80.w,
                            onTap: () {
                              BrnToast.show('录需求信息', context);
                            },
                          ),
                        ],
                      ),

                    ],
                  ),
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}
